package fifth.Method;

public class ToCharArray {
    public static void main(String[] args) {
        String str = "你好，Java";
        char[] c = str.toCharArray();
        for (int i = 0; i < c.length; i++) {
            System.out.println(c[i]);
        }
        System.out.println("打印c显示数组地址:"+c);
        String s1= new String(c);//把数组全部转换成字符串
        System.out.println("将c作为参数转换为String对象显示:"+s1);
        String s2 =new String(c,0,3);//转换部分字符串
        System.out.println("显示指定区域字符串："+s2);
    }
}
